﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using EpicBall.ScreenSystem;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;

namespace EpicBall.Levels.Classes
{
    class Warp : LevelObject
    {

        private bool _entrance;

        public Warp(PhysicsGameScreen screen, bool entrance, Texture2D texture) : base(screen, texture){
            _entrance = entrance;
        }

        public override bool isWarp() { return true; }
        public override bool isEntrance() { return _entrance; }

        //public override bool IgnoreCollision(Fixture f1, Fixture f2, Contact contact)
       // {
        //    return false;
        //}

        public override bool OnCollision(Fixture f1, Fixture f2, Contact contact)
        {
            if (f2.Body == _screen.Player && !_entrance)
            {
                _screen.GameStack.AddScreen(new LevelComplete(_screen, _screen.NextLevel()));
            }
            return false;
        }

        public override string type()
        {
            return "warp";
        }
    }
}
